import requests
import re

headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.41'}
for i  in range(1,57):
    url = f'https://www.meishij.net/chufang/diy/jiangchangcaipu/?&page={i}'
    html = requests.get(url, headers=headers)
    data = re.findall('<a target="_blank" href="(.*?)" title="(.*?)" class="big">', html.text)
    for u, t in data:
        print(i,t)
        html = requests.get(url=u, headers=headers)
        main = re.findall(
            '<strong><a target="_blank" href="https://www.meishij.net/shicaizuofa/.*?">(.*?)</a>(.*?)</strong>',
            html.text)
        print(main)
        burden_data = re.findall('<strong>辅料</strong>(.*?)<div class="recipe_qrcodebox">', html.text, re.S)
        burden = re.findall('<strong><a target="_blank" href="https://www.meishij.net/.*?">(.*?)</a>(.*?)</strong>',
                            burden_data[0])
        print(burden)
        break


